home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / web / spiderweb / src / awk / awk.spider < prev    next >
Encoding:
Text File  |  1993-04-04  |  4.9 KB  |  169 lines

  1. # Copyright 1989 by Norman Ramsey, Odyssey Research Associates
  2. # Not to be sold, but may be used freely for any purpose
  3. # For more information, see file COPYRIGHT in the parent directory
  4. language AWK extension awk
  5.  
  6. at_sign #
  7.  
  8. module definition stmt use stmt
  9. # use as stmt is unavoidable since tangle introduces line breaks
  10.  
  11. comment begin <"##"> end newline
  12. macros begin
  13. \def\commentbegin{\#} % we don't want \#\#
  14. macros end
  15.  
  16. line begin <"#line"> end <"">
  17.  
  18. default translation <*> mathness yes
  19.  
  20. token identifier category math mathness yes
  21. token number category math mathness yes
  22. token newline category newline translation <> mathness maybe
  23. token pseudo_semi category ignore_scrap mathness no translation <opt-0>
  24.  
  25. token \ category backslash translation <> mathness maybe
  26. token + category unorbinop
  27. token - category unorbinop
  28. token * category binop
  29. token / category binop
  30. token < category binop
  31. token > category binop
  32. token >> category binop translation <"\\GG">
  33. token = category equals translation <"\\K">
  34. token ~ category binop translation <"\\TI">
  35. token !~ category binop translation <"\\not\\TI">
  36. token & category binop translation <"\\amp">
  37. token % translation <"\\%"> category binop
  38. token ( category open
  39. token [ category lsquare
  40. token ) category close
  41. token ] category close
  42. token { translation <"\\;\\{"-indent> category lbrace
  43. token } translation <"\\}\\"-space> category close
  44. token , category binop translation <",\\,"-opt-3>
  45.  
  46. token ; category semi translation <";"-space-opt-2> mathness no
  47. # stuff with semi can be empty in for statements
  48. open semi --> open
  49. semi semi --> semi
  50. semi close --> close
  51. semi --> binop
  52.  
  53. # token : category colon
  54. # token | category bar
  55. token != name not_eq translation <"\\I"> category binop
  56. token <= name lt_eq translation <"\\L"> category binop
  57. token >= name gt_eq translation <"\\G"> category binop
  58. token == name eq_eq translation <"\\S"> category binop
  59. token && name and_and translation <"\\W"> category binop
  60. token || name or_or translation <"\\V"> category binop
  61. # token -> name minus_gt translation <"\\MG"> category binop
  62. token ++ name gt_gt category unop translation <"\\uparrow">
  63. token -- name lt_lt category unop translation <"\\downarrow">
  64. # preunop is for unary operators that are prefix only
  65. token $ category preunop translation <"\\DO"> mathness yes
  66.  
  67. default mathness yes translation <*>
  68.  
  69. ilk pattern_like category math
  70. reserved BEGIN ilk pattern_like
  71. reserved END ilk pattern_like
  72.  
  73. ilk if_like category if
  74. reserved if
  75. ilk else_like category else
  76. reserved else
  77.  
  78. ilk print_like category math
  79. # math forces space between this and other math...
  80. reserved print ilk print_like
  81. reserved printf ilk print_like
  82. reserved sprintf ilk print_like
  83.  
  84.  
  85. ilk functions category unop mathness yes
  86. reserved length ilk functions
  87. reserved substr ilk functions
  88. reserved index ilk functions
  89. reserved split ilk functions
  90. reserved sqrt ilk functions
  91. reserved log  ilk functions
  92. reserved exp ilk functions
  93. reserved int ilk functions
  94.  
  95. ilk variables category math mathness yes
  96. reserved NR ilk variables
  97. reserved NF ilk variables
  98. reserved FS ilk variables
  99. reserved RS ilk variables
  100. reserved OFS ilk variables
  101. reserved ORS ilk variables
  102.  
  103. ilk for_like category for
  104. reserved for ilk for_like
  105. reserved while ilk for_like
  106.  
  107. ilk in_like category binop translation <math_bin-*-"}"> mathness yes
  108. # translation <"\\"-space-*-"\\"-space>
  109. reserved in ilk in_like
  110.  
  111. ilk stmt_like category math
  112. reserved break ilk stmt_like
  113. reserved continue ilk stmt_like
  114. reserved next ilk stmt_like
  115. reserved exit ilk stmt_like
  116.  
  117.  
  118. backslash newline --> math
  119. # The following line must be changed to make a backslash
  120. backslash <"\\backslash"> --> math
  121.  
  122. math (binop|unorbinop) math --> math
  123. <"\\buildrel"> (binop|unorbinop) <"\\over{"> equals <"}"> --> binop
  124. equals --> binop
  125. (unop|preunop|unorbinop) math --> math
  126. # unorbinop can only act like unary op as *prefix*, not postfix
  127. math unop --> math
  128. math <"\\"-space> math --> math
  129. # concatenation
  130.  
  131. math newline --> stmt
  132. newline --> ignore_scrap
  133.  
  134. stmt <force> stmt --> stmt
  135.  
  136. (open|lsquare) math close --> math
  137.  
  138. math lbrace --> lbrace
  139. lbrace <force> stmt --> lbrace
  140. lbrace <outdent-force> close --> stmt
  141.  
  142. if <"\\"-space> math --> ifmath
  143. ifmath lbrace --> ifbrace
  144. ifmath newline --> ifline
  145. ifbrace <force> stmt --> ifbrace
  146. ifbrace <outdent-force> close else <"\\"-space> if --> if
  147. ifbrace <outdent-force> close else lbrace --> ifbrace
  148. ifbrace <outdent-force> close else newline --> ifline
  149. ifbrace <outdent-force> close --> stmt
  150. (ifline|ifmath) <indent-force> stmt <outdent-force> else <"\\"-space> if --> if
  151. (ifline|ifmath) <indent-force> stmt <outdent-force> else lbrace --> ifbrace
  152. (ifline|ifmath) <indent-force> stmt <outdent-force> else newline --> ifline
  153. (ifline|ifmath) <indent-force> stmt <outdent-force> else --> ifmath
  154. (ifline|ifmath) <indent-force> stmt <outdent> --> stmt
  155.  
  156. for <"\\"-space> math --> formath
  157. formath lbrace --> forbrace
  158. formath newline --> forline
  159. forbrace <force> stmt --> forbrace
  160. forbrace <outdent-force> close --> stmt
  161. (forline|formath) <indent-force> stmt <outdent> --> stmt
  162.  
  163.  
  164.  
  165. ? ignore_scrap --> #1
  166.  
  167.  
  168.  
  169.